package com.bookstore.mapper;

import com.bookstore.entity.Category;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CategoryMapper {
    int deleteByPrimaryKey(Long cId);

    int insert(Category record);

    int insertSelective(Category record);

    Category selectByPrimaryKey(Long cId);

    int updateByPrimaryKeySelective(Category record);

    int updateByPrimaryKey(Category record);


    /**
     * 获取树状的分类结构
     */
    List<Category> getAllCategory();

    @Select("select * from category where parent_id = #{p_id}")
    @ResultMap("BaseResultMap")
    List<Category> getCategoryByPID(@Param("p_id") Long pId);

}